<template>
  <div class="box-answer-score">得分:{{ score }}</div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  data() {
    return {
      allScore: 0
    }
  },
  computed: {
    ...mapState('score', { score: 'score', detailList: 'detailList' })
  },

  mounted() {
    if (window.history && window.history.pushState) {
      // 向历史记录中插入了当前页
      history.pushState(null, null, '/')
      window.addEventListener('popstate', this.goBack, false)
    }
  },

  created() {
    console.log(this.detailList)
  },
  destroyed() {
    window.removeEventListener('popstate', this.goBack, false)
  },

  methods: {
    goBack() {
      this.$router.replace('/')
      // sessionStorage.clear()
      // window.history.back()
    }
  }
}
</script>

<style lang="scss" scoped></style>
